package model

import (
	"lutai/src/service/db"
	"lutai/src/schema"
	"fmt"
)

type Company struct {
	db *db.DB
}

// Init 初始化
func (c *Company) Init(db *db.DB) *Company {
	db.AddTableWithName(schema.Company{}, schema.CompanyTableName)
	c.db = db
	return c
}


// Query 查询多条
func (a *Company) Query() ([]*schema.Company, error) {
	var companys []*schema.Company
	_, err := a.db.Select(&companys, fmt.Sprintf("select * from %s", schema.CompanyTableName))
	return companys, err
}
